package com.sykj.bsc.miaodiyun;

import java.net.URLEncoder;

import com.sykj.bsc.miaodiyun.common.Config;
import com.sykj.bsc.miaodiyun.common.HttpUtil;


///短信内容格式


/**
 * 验证码通知短信接口
 * 
 * @ClassName: IndustrySMS
 * @Description: 验证码通知短信接口
 *
 */
public class IndustrySMS
{
	private static String operation = "/industrySMS/sendSMS";

	private static String accountSid = Config.ACCOUNT_SID;

	/**
	 * 验证码通知短信
	 * to手机号:
	 * yanzhengma 验证码:
	 * tmpSmsContent短息内容
	 */
	public static void execute(String to,String yanzhengma)
	{
		String tmpSmsContent = null;
		String smsContent = "【三阳科技】您的验证码为"+yanzhengma+"，请于2分钟内正确输入，如非本人操作，请忽略此短信。";
	    try{
	      tmpSmsContent = URLEncoder.encode(smsContent, "UTF-8");//URLEncoder.encode解决乱码
	    }catch(Exception e){
	      
	    }
	    String url = Config.BASE_URL + operation;//url前半部分
	    String body = "accountSid=" + accountSid + "&to=" + to + "&smsContent=" + tmpSmsContent
	        + HttpUtil.createCommonParam();//构造请求

	    // 提交请求
	    String result = HttpUtil.post(url, body);//功能实现
	    System.out.println("result:" + System.lineSeparator() + result);
	}
}
